package com.linkoog.devtools.maven.mavenhelper;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.ProjectActivity;
import com.intellij.openapi.startup.StartupActivity;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.atomic.AtomicBoolean;

public class ShortcutStartupActivity implements ProjectActivity, DumbAware {
	private static final Logger LOG = com.intellij.openapi.diagnostic.Logger.getInstance(ShortcutStartupActivity.class);

	private static final AtomicBoolean registered = new AtomicBoolean();


	@Nullable
	@Override
	public Object execute(@NotNull Project project, @NotNull Continuation<? super Unit> continuation) {
		if (registered.compareAndSet(false, true)) {
			MavenHelperApplicationService.getInstance().initShortcuts();
		}
		return continuation.getContext();
	}
}
